package game.core.objects
{
	import flash.events.Event;
	
	import game.core.GameSystem;
	
	/**
	 * 最后出现的大的黄色的球,当点击时,所有的东西都需要完成
	 */ 
	public class CompletedBall extends Ball
	{
		public function CompletedBall()
		{
			super();
		}
		
		override public function execute():void {
			this.addEventListener(Event.ENTER_FRAME,enterFrameHandler);
		}
		
		private function enterFrameHandler(event:Event):void {
			var gameObjects:Array = GameSystem.instance.gameObjects;
			if(GameSystem.instance.hasGameObjects()){// 如果还有的话,就继续分
				for each(var gameObject:GameObject in gameObjects){
					gameObject.execute();
				}
			}else {
				this.removeEventListener(Event.ENTER_FRAME,enterFrameHandler);
			}
		}
	}
}